/**
 * @Author:       lee
 * @Email:        liwei@hiynn.com
 * @DateTime:     2017-11-23 21:22:23
 * @Description:  继承
 */
class Funlee {
  say() {
    console.log(123)
  }
}

var t1 = new Funlee()
t1.say()

class Lee extends Funlee {
  constructor(x,y,color) { //必须调用super()方法，默认是给调用了的
    super(x,y)
    this.color = color
  }
  love() {
    return this.color + ',' + super.love()
  }
}

var t2 = new Lee()
t2.say()
//-------------------------------------------------------------------

class Point{
  constructor(x,y) {
    this.x = x;
    this.y = y
  }
}

class ColorPoint extends Point {
  constructor(x,y,color) {
   super(x,y)//super虽然代表了父类Point的构造函数，但是返回的是子类ColorPoint的实例，即super内部的this指的是ColorPoint，因此super()在这里相当于 Point.prototype.constructor.call(this)
   this.color = color
  }
  say() {
    console.log(this.x + '||' + this.y + '||' + this.color)
  }
}

const test = new ColorPoint(12,56,'red')
//--------------------------------------------------------------------------
class Point{
  constructor(x,y) {
    this.x = x;
    this.y = y
  }
}

class ColorPoint extends Point {
  constructor(x,y,color) {
  super()
  this.x = 5555;
  this.y=666;
   this.color = color
  }
  say() {
    console.log(this.x + '||' + this.y + '||' + this.color)
  }
}

const test = new ColorPoint(12,56,'red')
;test.say()//5555||666||red
//----------------------------------------------------------------------------












